/* 
 * File:   Main2.cpp
 * Author: Guilherme Monteiro
 * 
 */

#include "../headers/Main2.h"

Main2::Main2() {
}

Main2::Main2(const Main2& orig) {
}

Main2::~Main2() {
}

//int main(int argc, char** argv) {
//    try {
//        string highTablePath = "/books/anuario1916pb/metadados/tabelasAlta/image11_0.png";
//
//        TessMetaInfo* meta = new TessMetaInfo(highTablePath);
//        ImageFormatConverter* converter = new ImageFormatConverter(meta);
//        converter->convertToTiffFormat();
//               
//        Reader* reader = new Reader(meta->getUserAnswerPath());
//        vector<Cell> cells = reader->readCells();
//        
//        printf("cells.size: %d\n", (int)cells.size());
//        
//        for(int i = 0; i < cells.size(); i++) {
//            printf("cell after erase: (%d,%d)-(%d,%d)\n", 
//                    cells[i].leftUpper.x,
//                    cells[i].leftUpper.y,
//                    cells[i].rightBottom.x,
//                    cells[i].rightBottom.y);
//        }
//        
//        GenericAdapter* genericAdapter = new GenericAdapter(LOW_2_HIGH, meta);
//        vector<Cell> cellsAdapted = genericAdapter->adaptCells(cells);
//
//        TesseractExecutor* executor = new TesseractExecutor(cellsAdapted, meta->getTIFFImagePath());
//        vector<Transcription*> transcriptions = executor->runTesseract();
//        
//        printf("transcriptions.size(): %d\n", (int)transcriptions.size());
//        
//        File* f1 = new File(meta->getOutputTextsFileName());
//        File* f2 = new File(meta->getOutputConfidencesFileName());
//        
//        f1->writeHeader1("#0,0,0,0");
//        f2->writeHeader1("#0,0,0,0");
//        
//        vector<Transcription*>::iterator itTransc;
//        for (itTransc = transcriptions.begin(); itTransc != transcriptions.end(); itTransc++) {
//            f1->writeHeaderN((*itTransc)->getText());
//
//            std::ostringstream sstream;
//            sstream << (*itTransc)->getMeanTextConfidence();
//            std::string taxAsString = sstream.str();
//
//            f2->writeHeaderN(taxAsString);
//        }
//
//        printf("====> TesseractExecutorApp executed with success.\n");
//
//    }    
//    catch (NullImageException nie) {
//        cerr << nie.what() << endl;
//    } 
//    catch (InvalidFileException ife) {
//        cerr << ife.what() << endl;
//    }
//    catch (exception e) {
//        cerr << e.what() << endl;
//    }
//
//    return 0;
//}